﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SafeScript.MetaModel.Statements
{
    public class ThrowStatement : Statement
    {
        public Operator Operator;

        public override void ComputeType(ErrorReport report)
        {
            ITypeDef t = this.Operator.ComputeType(null, false, report);
            if (t == null)
                return;
            if (!(t is InstanceType))
                report.Add(new ErrorEntry(this.Operator.Node) { Type = ErrorType.NotAnObject });
        }
    }
}
